﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using OgilvyOne.UKNow.BLL;
using OgilvyOne.UKNow.Model;
using ECCIT.Extension.Weibo_v2.Common;
using OgilvyOne.UKNow.Mobile.Utilities;
using OgilvyOne.UKNow.Mobile.Model.Art;
namespace OgilvyOne.UKNow.Mobile.APIs.Artfrom
{

   public class GetList:IHttpHandler
    {
        public bool IsReusable
        {
            get { throw new NotImplementedException(); }
        }

        public void ProcessRequest(HttpContext context)
        {
            try
            {
                GetArtList(context);
            }
            catch (Exception)
            {
                
                 context.Response.Write(ResultUtility.ReturnResultJson("-700","", "获取艺术失败"));
            }
        }
        private void GetArtList(HttpContext htc)
        {
            ArtFormBLL afbll = new ArtFormBLL(2052);
            IList<ArtFormModel>  lam= afbll.GetArtFormModels();
            List<ArtMod> la = new List<ArtMod>();
            foreach (ArtFormModel afm in lam)
            {
                ArtMod am = new ArtMod();
                am.Id = afm.ID.ToString();
                am.Name = afm.Name;
                la.Add(am);
            }
            ArtList al = new ArtList();
            al.list = la;
            string s = JsonSerializationHelper.ObjectToJson(al);
           
            htc.Response.Write(ResultUtility.ReturnResultJson("0", s, "获取艺术形式列表成功"));
        }
    }
}
